<?php
/**
* @package Frontend-User-Access (com_frontenduseraccess)
* @version 3.0.8
* @copyright Copyright (C) 2008 Carsten Engel. All rights reserved.
* @license GPL versions free/trial/pro
* @author http://www.pages-and-items.com
* @joomla Joomla is Free Software
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

if($this->controller->user_type!='Super Administrator'){
	echo "<script> alert('you need to be logged in as a super administrator to edit the Frontend-User-Access config.'); window.history.go(-1); </script>";
	exit();
}



?>
<script src="../includes/js/overlib_mini.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_frontenduseraccess/javascript/javascript.js" language="JavaScript" type="text/javascript"></script>
<link href="components/com_frontenduseraccess/css/frontenduseraccess.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript">



function submitbutton(pressbutton) {
	if (pressbutton == 'config_save') {
		submitform('config_save');
	}
	if (pressbutton == 'config_apply') {	
		document.getElementById('sub_task').value = 'apply';
		submitform('config_save');
	}		
	if (pressbutton == 'cancel') {
		document.location.href = 'index2.php?option=com_frontenduseraccess';		
	}	
}

function batch_form_submit(batch_type){
	if(batch_type=='batch_assign_jtofua'){
		if(confirm('<?php echo addslashes(JText::_('SURE_BATCH_JTOFUA')); ?>')){			
			j = document.adminForm.batch_assign_jtofua_jgroup.value;
			f = document.adminForm.batch_assign_jtofua_fuagroup.value;
			document.location.href = 'index3.php?option=com_frontenduseraccess&view=batchassign&j='+j+'&f='+f+'&batchtype=jf';
		}
	}
	if(batch_type=='batch_assign_fuatofua'){
		f1 = document.adminForm.batch_assign_fuatofua_old.value;
		f2 = document.adminForm.batch_assign_fuatofua_new.value;
		if(f1==f2){
			alert('<?php echo addslashes(JText::_('CAN_NOT_MOVE_TO_SAME_GROUP')); ?>');
		}else{
			if(confirm('<?php echo addslashes(JText::_('SURE_BATCH_FUATOFUA')); ?>')){				
				document.location.href = 'index3.php?option=com_frontenduseraccess&view=batchassign&f1='+f1+'&f2='+f2+'&batchtype=ff';
			}
		}		
	}
}

<?php

$tab = $this->controller->get_var('tab', false);	

if(!$tab){
	
	echo "cookie_value = getCookie('fua_tabs');"."\n";	
	echo "if(cookie_value!=null){"."\n";		
		echo "current_tab = cookie_value;"."\n";
	echo "}else{"."\n";		
		echo "setCookie('fua_tabs', 'general_settings', '', '', '', '');"."\n";
		echo "current_tab = 'general_settings';"."\n";
	echo "}"."\n";
}else{
	echo "setCookie('fua_tabs', '".$tab."', '', '', '', '');"."\n";
	echo "current_tab = '".$tab."';"."\n";
}

?>

function get_tab(tab){
	if(tab!=current_tab){
		new_tab = 'tab_'+tab;	
		document.getElementById(new_tab).className = 'on';
		old_tab = 'tab_'+current_tab;	
		document.getElementById(old_tab).className = 'none';
		document.getElementById(tab).style.display = 'block';	
		document.getElementById(current_tab).style.display = 'none';
		current_tab = tab;
		setCookie('fua_tabs', tab, '', '', '', '');
	}
}

function pi_config_menu_init(){
	current_tab_name = 'tab_'+current_tab;	
	document.getElementById(current_tab_name).className = 'on';
	document.getElementById(current_tab).style.display = 'block';	
}

if(window.addEventListener)window.addEventListener("load",pi_config_menu_init,false);else if(window.attachEvent)window.attachEvent("onload",pi_config_menu_init);

</script>

<form name="adminForm" method="post" action="">
	<input type="hidden" name="option" value="com_frontenduseraccess" />
	<input type="hidden" name="task" value="" />	
	<input type="hidden" name="sub_task" id="sub_task" value="" />	
	<?php echo JHTML::_( 'form.token' ); ?>	
	<div style="margin: 0 auto; text-align: left;">	
		<?php
			$this->controller->check_demo_time_left();
		?>
		<a href="index2.php?option=com_frontenduseraccess">Frontend User Access</a>	&gt; <?php echo JText::_('CONFIG'); ?>
		<h2>Frontend User Access configuration</h2>			
		<ul id="fua_menu">				
			<li>
				<a id="tab_general_settings" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('general_settings');"><span><?php echo JText::_('GENERAL'); ?></span></a>
			</li>
			<li>
				<a id="tab_users" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('users');"><span><?php echo JText::_('USERS'); ?></span></a>
			</li>				
			<li>
				<a id="tab_item_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('item_access');"><span><?php echo JText::_('ITEM_ACCESS'); ?></span></a>
			</li>
			<li>
				<a id="tab_category_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('category_access');"><span><?php echo JText::_('CATEGORY_ACCESS'); ?></span></a>
			</li>
			<li>
				<a id="tab_section_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('section_access');"><span><?php echo JText::_('SECTION_ACCESS'); ?></span></a>
			</li>	
			<li>
				<a id="tab_module_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('module_access');"><span><?php echo JText::_('MODULE_ACCESS'); ?></span></a>
			</li>		
			<li>
				<a id="tab_component_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('component_access');"><span><?php echo JText::_('COMPONENT_ACCESS'); ?></span></a>
			</li>			
			<li>
				<a id="tab_menu_access" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('menu_access');"><span><?php echo JText::_('MENU_ACCESS'); ?></span></a>
			</li>	
			<li>
				<a id="tab_paid_content" onfocus="if(this.blur)this.blur();" href="javascript:get_tab('paid_content');"><span><?php echo JText::_('PAID_CONTENT'); ?></span></a>
			</li>			
		</ul>				
		<div id="general_settings">
		<table class="adminlist">			
			<tr>
				<th colspan="3" align="left">									
					<?php echo JText::_('GENERAL'); ?>
				</th>
			</tr>			
			<tr>		
				<td width="230">
					<?php echo JText::_('CACHE'); ?>		
				</td>
				<td>
					<?php 
					 $config =& JFactory::getConfig();
        			if ($config->getValue('caching')){					
						echo '<span style="color: red;">'.JText::_('IS_ENABLED').'</span>';
					}else{
						echo '<span style="color: #5F9E30;">'.JText::_('IS_NOT_ENABLED').'</span>';
					}			
				?>					
				</td>
				<td>
					<?php 
					echo JText::_('CACHE_INFO').'<br />'; 
					echo JText::_('CACHE_INFO2'); 
					echo ' <a href="index.php?option=com_config">';
					echo JText::_('GLOBAL_CONFIG');
					echo '</a> ';
					echo JText::_('CACHE_INFO3').'.'; 
					?>	
				</td>
			</tr>					
			<tr>		
				<td>
					<?php echo JText::_('STATUSBOT'); ?> (system)
				</td>
				<td>
					<?php 
					if($this->controller->bot_installed_system){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTINSTALLED').'</div>';				
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTINSTALLED').'</div>';
					}										
					if($this->controller->bot_published_system){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTPUBLISHED').'</div>';		
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTPUBLISHED').'</div>';
					}					
					?>
				</td>
				<td>&nbsp;
					
				</td>
			</tr>			
			<tr>		
				<td>
					<?php echo JText::_('STATUSBOT'); ?> (content)
				</td>
				<td>
					<?php 
					if($this->controller->bot_installed_content){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTINSTALLED').'</div>';				
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTINSTALLED').'</div>';
					}
					if($this->controller->bot_published_content){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTPUBLISHED').'</div>';		
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTPUBLISHED').'</div>';
					}
					?>
				</td>
				<td>&nbsp;
					
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('STATUSBOT'); ?> (user)					
				</td>
				<td>					
					<?php 
					$system_plugin_installed = false;
					$system_plugin_enabled = false;
					
					//check if plugin is installed and published
					$this->controller->db->setQuery("SELECT published "
					."FROM #__plugins "
					."WHERE element='frontenduseraccess' AND folder='user' "
					."LIMIT 1"					
					);
					$rows = $this->controller->db->loadObjectList();					
					foreach($rows as $row){	
						$system_plugin_installed = true;
						$system_plugin_enabled = $row->published;
					}
										
					if($system_plugin_installed){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTINSTALLED').'</div>';				
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTINSTALLED').'</div>';
					}
					if($system_plugin_enabled){
						echo '<div style="color: #5F9E30;">'.JText::_('BOTPUBLISHED').'</div>';				
					}else{
						echo '<div style="color: red;">'.JText::_('BOTNOTPUBLISHED').'</div>';
					}				
					?>
				</td>
				<td>
					<?php
					
					echo JText::_('USER_PLUGIN_NOT_NEEDED').'.';
					if($this->controller->fua_version_type=='free'){
						echo '<br /><span style="color: red;">'.JText::_('NOT_IN_FREE').'</span> ';
					}
					?>
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('STATUS_MENU_MODULE'); ?>
				</td>
				<td>
					<?php 					
					if(file_exists(dirname(__FILE__).'/../../../../../../modules/mod_frontenduseraccessmenu/mod_frontenduseraccessmenu.php')){	
						echo '<div style="color: #5F9E30;">'.JText::_('MODULE_INSTALLED').'</div>';				
					}else{
						echo '<div style="color: red;">'.JText::_('MODULE_NOT_INSTALLED').'</div>';
					}					
					?>
				</td>
				<td>
					<?php echo JText::_('STATUS_MENU_MODULE_INFO').'.'; ?>					
				</td>
			</tr>		
			<tr>		
				<td>
					<?php echo JText::_('DEFAULTTAB'); ?>
				</td>
				<td>
					<select name="default_tab">
						<?php							
							echo '<option value="usergroups"';
							if($this->controller->fua_config['default_tab']=='usergroups'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('USERGROUPS').'</option>';
							echo '<option value="users"';
							if($this->controller->fua_config['default_tab']=='users'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('USERS').'</option>';							
							echo '<option value="items"';
							if($this->controller->fua_config['default_tab']=='items'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('ITEM_ACCESS').'</option>';
							echo '<option value="categories"';
							if($this->controller->fua_config['default_tab']=='categories'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('CATEGORY_ACCESS').'</option>';	
							echo '<option value="sections"';
							if($this->controller->fua_config['default_tab']=='sections'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('SECTION_ACCESS').'</option>';	
							echo '<option value="modules"';
							if($this->controller->fua_config['default_tab']=='modules'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('MODULE_ACCESS').'</option>';						
							echo '<option value="components"';
							if($this->controller->fua_config['default_tab']=='components'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('COMPONENT_ACCESS').'</option>';
							echo '<option value="menuaccess"';
							if($this->controller->fua_config['default_tab']=='menuaccess'){
								echo ' selected="selected"';
							}
							echo '>'.JText::_('MENU_ACCESS').'</option>';																	
						?>					
					</select>
				</td>
				<td>&nbsp;
					
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<?php echo JText::_('SHOW_TAB'); ?>
				</td>
			</tr>
						
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_usergroups" value="true" <?php if($this->controller->fua_config['display_usergroups']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('USERGROUPS'); ?></label>
				</td>
			</tr>			
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_users" value="true" <?php if($this->controller->fua_config['display_users']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('USERS'); ?></label>
				</td>
			</tr>
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_items" value="true" <?php if($this->controller->fua_config['display_items']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('ITEM_ACCESS'); ?></label>			
				</td>
			</tr>
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_categories" value="true" <?php if($this->controller->fua_config['display_categories']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('CATEGORY_ACCESS'); ?></label>		
				</td>
			</tr>	
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_sections" value="true" <?php if($this->controller->fua_config['display_sections']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('SECTION_ACCESS'); ?></label>	
				</td>
			</tr>	
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_modules" value="true" <?php if($this->controller->fua_config['display_modules']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('MODULE_ACCESS'); ?></label>	
				</td>
			</tr>						
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_components" value="true" <?php if($this->controller->fua_config['display_components']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('COMPONENT_ACCESS'); ?></label>			
				</td>
			</tr>	
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<label><input type="checkbox" name="display_menuaccess" value="true" <?php if($this->controller->fua_config['display_menuaccess']){echo 'checked="checked"';} ?> class="checkbox" /><?php echo JText::_('MENU_ACCESS'); ?></label>			
				</td>
			</tr>					
			<tr>		
				<td>
					<?php echo strtolower(JText::_('VERSION')); ?>	
				</td>
				<td>
					<?php echo $this->controller->version; ?>
				</td>
				<td>&nbsp;
					
				</td>
			</tr>				
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>
			</table>
			</div>
			<div id="users">
			<table class="adminlist">			
			<tr>
				<th colspan="3" align="left">
				
					<?php echo JText::_('USERS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="230">
					<?php echo JText::_('SHOWJOOMLAGROUP'); ?>
				</td>
				<td colspan="2">
					<label><input type="radio" name="show_joomla_group_select" value="true" <?php if($this->controller->fua_config['show_joomla_group_select']=='1'){echo 'checked="checked"';} ?> class="radio" />				
					<?php echo JText::_('SHOWJOOMLAGROUP_TIP'); ?></label><br />
					<label><input type="radio" name="show_joomla_group_select" value="false" <?php if($this->controller->fua_config['show_joomla_group_select']=='0'){echo 'checked="checked"';} ?> class="radio" />	
					<?php echo JText::_('DISABLESELECTBOX'); ?></label>	
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('DEFAULT_USERGROUP'); ?>
				</td>
				<td>
					<?php
						$this->controller->db->setQuery("SELECT * FROM #__fua_usergroups WHERE (id!='9') AND (id!='10') ORDER BY name");
						$fua_usergroups = $this->controller->db->loadObjectList();
					?>
					<select name="default_usergroup">
						<?php						
						if(count($fua_usergroups)){	
							echo '<option value="0">'.JText::_('NONE').'</option>';									
							foreach($fua_usergroups as $row){								
								echo '<option value="'.$row->id.'"';
								if($this->controller->fua_config['default_usergroup']==$row->id){
									echo ' selected="selected"';
								}
								echo '>';							
								echo $row->name;
								echo '</option>';								
							}
						}
						?>						
					</select> 
				</td>
				<td>
					<?php 
					if(!$fua_usergroups){
						echo '<span style="color: red;">'.JText::_('NOUSERGROUPS').'</span> ';
					}
					echo JText::_('DEFAULT_USERGROUP_INFO'); 
					if($this->controller->fua_version_type=='free'){
						echo '<br /><span style="color: red;">'.JText::_('NOT_IN_FREE').'</span> ';
					}
					?>
				</td>
			</tr>
			<tr>		
				<td>
					<?php 
					echo JText::_('REDIRECT_AFTER_LOGIN'); 					
					$redirect_url = '';
					if($this->controller->fua_config['redirect_url']){
						$redirect_url = $this->controller->fua_config['redirect_url'];
					}
					
					?>
				</td>
				<td width="350">
					<input type="text" name="redirect_url" value="<?php echo $redirect_url; ?>" style="width: 300px;" /><br />
					<?php echo JText::_('EXAMPLE'); ?>: <br />index.php?option=com_content&view=article&id=19&Itemid=27
				</td>
				<td>
					<?php 
					echo JText::_('REDIRECT_AFTER_LOGIN_INFO').'.'; 					
					if($this->controller->fua_version_type=='free'){
						echo '<br /><span style="color: red;">'.JText::_('NOT_IN_FREE').'</span> ';
					}else{
						if(!$system_plugin_installed){							
							echo '<div style="color: red;">user '.JText::_('BOTNOTINSTALLED').'</div>';
						}
						if(!$system_plugin_enabled){							
							echo '<div style="color: red;">user '.JText::_('BOTNOTPUBLISHED').'</div>';
						}
					}
					?>
				</td>
			</tr>
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>
			<tr>		
				<td colspan="3"><?php echo JText::_('BATCH_ASSIGN_USERS'); ?>					
				</td>
			</tr>
			<tr>		
				<td>&nbsp;
					
				</td>
				<td>
					<?php echo JText::_('FROM').' '.JText::_('JOOMLAGROUP'); ?><br />
					<select name="batch_assign_jtofua_jgroup">
						<option value="18"><?php echo JText::_('REGISTERED'); ?></option>
						<option value="19"><?php echo JText::_('AUTHOR'); ?></option>
						<option value="20"><?php echo JText::_('EDITOR'); ?></option>
						<option value="21"><?php echo JText::_('PUBLISHER'); ?></option>
						<option value="23"><?php echo JText::_('MANAGER'); ?></option>
						<option value="24"><?php echo JText::_('ADMINISTRATOR'); ?></option>
					</select><br />					
					<?php echo JText::_('TO').' '.JText::_('USERGROUP'); ?><br />
					<select name="batch_assign_jtofua_fuagroup">
						<?php
						if(count($fua_usergroups)){	
							echo '<option value="0">'.JText::_('NONE').'</option>';									
							foreach($fua_usergroups as $row){								
								echo '<option value="'.$row->id.'">';														
								echo $row->name;
								echo '</option>';									
							}
						}
						?>						
					</select><br /><br />
					<input type="button" value="<?php echo JText::_('GO'); ?>" onclick="batch_form_submit('batch_assign_jtofua')" />
				</td>
				<td>
					<?php echo JText::_('BATCH_ASSIGN_USERS_INFO_JTOFUA').'.'; ?>
				</td>
			</tr>	
			<tr>		
				<td>&nbsp;
					
				</td>
				<td>
					<?php echo JText::_('FROM').' '.JText::_('USERGROUP'); ?><br />
					<select name="batch_assign_fuatofua_old">
						<?php
						if(count($fua_usergroups)){	
							echo '<option value="0">'.JText::_('NONE').'</option>';									
							foreach($fua_usergroups as $row){								
								echo '<option value="'.$row->id.'">';														
								echo $row->name;
								echo '</option>';									
							}
						}
						?>	
					</select><br />					
					<?php echo JText::_('TO').' '.JText::_('USERGROUP'); ?><br />
					<select name="batch_assign_fuatofua_new">
						<?php
						if(count($fua_usergroups)){	
							echo '<option value="0">'.JText::_('NONE').'</option>';									
							foreach($fua_usergroups as $row){								
								echo '<option value="'.$row->id.'">';														
								echo $row->name;
								echo '</option>';									
							}
						}
						?>						
					</select><br /><br />
					<input type="button" value="<?php echo JText::_('GO'); ?>" onclick="batch_form_submit('batch_assign_fuatofua')" />
				</td>
				<td>
					<?php echo JText::_('BATCH_ASSIGN_USERS_INFO_FUATOFUA').'.'; ?>
				</td>
			</tr>			
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>	
			</table>
			</div>				
			<div id="item_access">
			<table class="adminlist">						
			<tr>
				<th colspan="3" align="left">
					
					<?php echo JText::_('ITEM_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('ITEMS_ACTIVATE'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="items_active" value="true" <?php if($this->controller->fua_config['items_active']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('ITEMS_INFO').'. '.JText::_('ONLY_IN_COM_CONTENT').'.'; ?>					
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="items_reverse_access" value="true" <?php if($this->controller->fua_config['items_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('DISPLAY_ARTICLES'); ?>
				</td>
				<td colspan="2">									
					<label><input type="radio" name="items_display_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['items_display_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?>:</label> <input type="text" name="message_no_item_access" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_item_access']){echo $this->controller->fua_config['message_no_item_access'];}else{echo JText::_('NO_ACCESS_ITEM');} ?>" /><br />	
					<label><input type="radio" name="items_display_type" value="hide" class="radio" <?php if($this->controller->fua_config['items_display_type']=='hide'){echo 'checked="checked"';} ?> /><?php echo JText::_('HIDE_ARTICLE'); ?></label>					
				</td>
			</tr>		
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_ITEMS'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('NO_ACCESS_MESSAGE'); ?>:
					<input type="text" name="message_no_item_access_full" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_item_access_full']){echo $this->controller->fua_config['message_no_item_access_full'];}else{echo JText::_('NO_ACCESS_PAGE');} ?>" /><br />
					<label><input type="radio" name="items_message_type" value="alert" class="radio" <?php if($this->controller->fua_config['items_message_type']=='alert'){echo 'checked="checked"';} ?> /><?php echo JText::_('COMPONENTS_MESSAGE_TYPE_ALERT'); ?></label><br />
					<label><input type="radio" name="items_message_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['items_message_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?></label><br />
					<label><input type="radio" name="items_message_type" value="only_text" class="radio" <?php if($this->controller->fua_config['items_message_type']=='only_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_ONLY_TEXT'); ?></label><br />
					<label><input type="radio" name="items_message_type" value="redirect" class="radio" <?php if($this->controller->fua_config['items_message_type']=='redirect'){echo 'checked="checked"';} ?> /><?php echo JText::_('REDIRECT_TO_URL'); ?></label>:
					<?php
					$no_item_access_full_url = '';
					if($this->controller->fua_config['no_item_access_full_url']){
						$no_item_access_full_url = $this->controller->fua_config['no_item_access_full_url'];
					}
					?>
					<input type="text" name="no_item_access_full_url" class="long_text_field" value="<?php echo $no_item_access_full_url; ?>" />
					
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_ARCHIVE'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('MESSAGETYPE_ARCHIVE_INFO'); ?>
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('TRUNCATE_ARTICLE_TITLE'); ?>
				</td>
				<td>
					<?php 
					
					$selected = 'selected="selected"'; 					
					echo '<select name="truncate_article_title">';
					echo '<option value="">'.JText::_('NONE').'</option>';
					$truncate_array = array(30, 40, 50, 60, 70, 80, 100);
					foreach($truncate_array as $truncate_number){		
						echo '<option value="'.$truncate_number.'"';
						if($this->controller->fua_config['truncate_article_title']==$truncate_number){
							echo $selected;
						}				
						echo '>'.$truncate_number.'</option>';						
					}
					echo '</select>';
					
					?>					
				</td>
				<td>
					<?php echo JText::_('TRUNCATE_ARTICLE_TITLE_INFO'); ?>.					
				</td>
			</tr>				
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>	
			</table>
			</div>			
			<div id="category_access">
			<?php $this->controller->not_in_free_version(); ?>
			<table class="adminlist">					
			<tr>
				<th colspan="3" align="left">
					
					<?php echo JText::_('CATEGORY_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('ACTIVATECATEGORIES'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="categories_active" value="true" <?php if($this->controller->fua_config['categories_active']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('CATEGORIES_INFO').'. '.JText::_('ONLY_IN_COM_CONTENT').'.'; ?>
				</td>
			</tr>	
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="category_reverse_access" value="true" <?php if($this->controller->fua_config['category_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>			
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_CATEGORY'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('NO_ACCESS_MESSAGE'); ?>:
					<input type="text" name="message_no_category_access" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_category_access']){echo $this->controller->fua_config['message_no_category_access'];}else{echo JText::_('NO_ACCESS_PAGE');} ?>" /><br />			
					<label><input type="radio" name="category_message_type" value="alert" class="radio" <?php if($this->controller->fua_config['category_message_type']=='alert'){echo 'checked="checked"';} ?> /><?php echo JText::_('COMPONENTS_MESSAGE_TYPE_ALERT'); ?></label><br />
					<label><input type="radio" name="category_message_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['category_message_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?></label><br />
					<label><input type="radio" name="category_message_type" value="only_text" class="radio" <?php if($this->controller->fua_config['category_message_type']=='only_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_ONLY_TEXT'); ?></label><br />					
					<label><input type="radio" name="category_message_type" value="redirect" class="radio" <?php if($this->controller->fua_config['category_message_type']=='redirect'){echo 'checked="checked"';} ?> /><?php echo JText::_('REDIRECT_TO_URL'); ?></label>:
					<?php
					$no_category_access_url = '';
					if($this->controller->fua_config['no_category_access_url']){
						$no_category_access_url = $this->controller->fua_config['no_category_access_url'];
					}
					?>
					<input type="text" name="no_category_access_url" class="long_text_field" value="<?php echo $no_category_access_url; ?>" />
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('DISPLAY_OTHER'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('SEE_ARTICLE_ACCESS').' \''.JText::_('DISPLAY_ARTICLES').'\' '.JText::_('ON_TAB'); ?> <a href="javascript: get_tab('item_access');"><?php echo JText::_('ITEM_ACCESS'); ?></a>.
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_ARCHIVE'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('MESSAGETYPE_ARCHIVE_INFO'); ?>
				</td>
			</tr>		
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>
			</table>
			</div>	
			<div id="section_access">
			<?php $this->controller->not_in_free_version(); ?>
			<table class="adminlist">					
			<tr>
				<th colspan="3" align="left">
					
					<?php echo JText::_('SECTION_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('SECTIONS_ACTIVE'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="sections_active" value="true" <?php if($this->controller->fua_config['sections_active']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('SECTIONS_INFO').'. '.JText::_('ONLY_IN_COM_CONTENT').'.'; ?>
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="sections_reverse_access" value="true" <?php if($this->controller->fua_config['sections_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_SECTION'); ?>
				</td>
				<td colspan="2">	
					<?php echo JText::_('NO_ACCESS_MESSAGE'); ?>:
					<input type="text" name="message_no_section_access" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_section_access']){echo $this->controller->fua_config['message_no_section_access'];}else{echo JText::_('NO_ACCESS_PAGE');} ?>" /><br />				
					<label><input type="radio" name="section_message_type" value="alert" class="radio" <?php if($this->controller->fua_config['section_message_type']=='alert'){echo 'checked="checked"';} ?> /><?php echo JText::_('COMPONENTS_MESSAGE_TYPE_ALERT'); ?></label><br />
					<label><input type="radio" name="section_message_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['section_message_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?></label><br />
					<label><input type="radio" name="section_message_type" value="only_text" class="radio" <?php if($this->controller->fua_config['section_message_type']=='only_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_ONLY_TEXT'); ?></label><br />
					<label><input type="radio" name="section_message_type" value="redirect" class="radio" <?php if($this->controller->fua_config['section_message_type']=='redirect'){echo 'checked="checked"';} ?> /><?php echo JText::_('REDIRECT_TO_URL'); ?></label>:
					<?php
					$no_section_access_url = '';
					if($this->controller->fua_config['no_section_access_url']){
						$no_section_access_url = $this->controller->fua_config['no_section_access_url'];
					}
					?>
					<input type="text" name="no_section_access_url" class="long_text_field" value="<?php echo $no_section_access_url; ?>" />
					
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('DISPLAY_OTHER'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('SEE_ARTICLE_ACCESS').' \''.JText::_('DISPLAY_ARTICLES').'\' '.JText::_('ON_TAB'); ?> <a href="javascript: get_tab('item_access');"><?php echo JText::_('ITEM_ACCESS'); ?></a>.
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('MESSAGETYPE_ARCHIVE'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('MESSAGETYPE_ARCHIVE_INFO'); ?>
				</td>
			</tr>			
			<tr>		
				<td colspan="3">&nbsp;
					
				</td>
			</tr>
			</table>
			</div>				
			<div id="module_access">
			<?php $this->controller->not_in_free_version(); 			
			
			$database_name = $config->getValue('db');							
			$this->controller->db->setQuery("SHOW TABLES FROM `".$database_name."` ");
			$tables_array = $this->controller->db->loadResultArray();				
			$prefix = $config->getValue('dbprefix');
			$table_name = $prefix.'fua_modules';									
				
			if(in_array($table_name, $tables_array)){
				echo '<div style="border: 1px solid red; padding: 5px;">';
				echo '<img src="../includes/js/ThemeOffice/warning.png" alt="read this carefully" /> ';
				echo JText::_('OLD_MODULE_INFO').'. ';
				echo '<a href="index2.php?option=com_frontenduseraccess&view=modules">'.JText::_('READ_MORE').'</a><br />';
				echo '</div><br />';
			}
			
			?>			
			<table class="adminlist">						
			<tr>
				<th colspan="3" align="left">
					
					<?php echo JText::_('MODULE_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('USE_MODULEACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" name="modules_active" value="true" <?php if($this->controller->fua_config['modules_active']){echo 'checked="checked"';} ?> />
				</td>
				<td><?php
				echo JText::_('MODULES_INFO').'.';
				?>
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="modules_reverse_access" value="true" <?php if($this->controller->fua_config['modules_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('ENABLE_DOCMAN_WORKAROUND'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="docman_workaround" value="true" <?php if($this->controller->fua_config['docman_workaround']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('ENABLE_DOCMAN_WORKAROUND_INFO'); ?>.					
				</td>
			</tr>			
			<tr>		
				<td>&nbsp;
					
				</td>
				<td colspan="2">
					<?php echo JText::_('MODULES_INFO2'); ?>.		
				</td>				
			</tr>
			<tr>
				<td colspan="3">&nbsp;
																								
				</td>
			</tr>			
			</table>
			</div>			
			<div id="component_access">			
			<table class="adminlist">						
			<tr>
				<th colspan="3" align="left">					
					<?php echo JText::_('COMPONENT_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('USE_COMPONENTACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" name="use_componentaccess" value="true" <?php if($this->controller->fua_config['use_componentaccess']){echo 'checked="checked"';} ?> />
				</td>
				<td><?php echo JText::_('COMPONENTS_INFO').'.'; ?>
				</td>
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="component_reverse_access" value="true" <?php if($this->controller->fua_config['component_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('COMPONENTS_MESSAGE_TYPE'); ?>
				</td>
				<td colspan="2">
					<?php echo JText::_('NO_ACCESS_MESSAGE'); ?>:
					<input type="text" name="message_no_component_access" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_component_access']){echo $this->controller->fua_config['message_no_component_access'];}else{echo JText::_('NO_ACCESS_PAGE');} ?>" /><br />
					<label><input type="radio" name="components_message_type" value="alert" class="radio" <?php if($this->controller->fua_config['components_message_type']=='alert'){echo 'checked="checked"';} ?> /><?php echo JText::_('COMPONENTS_MESSAGE_TYPE_ALERT'); ?></label><br />					
					<label><input type="radio" name="components_message_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['components_message_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?></label><br />
					<label><input type="radio" name="components_message_type" value="only_text" class="radio" <?php if($this->controller->fua_config['components_message_type']=='only_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_ONLY_TEXT'); ?></label><br />
					<label><input type="radio" name="components_message_type" value="redirect" class="radio" <?php if($this->controller->fua_config['components_message_type']=='redirect'){echo 'checked="checked"';} ?> /><?php echo JText::_('REDIRECT_TO_URL'); ?></label>:
					<?php
					$no_component_access_url = '';
					if($this->controller->fua_config['no_component_access_url']){
						$no_component_access_url = $this->controller->fua_config['no_component_access_url'];
					}
					?>
					<input type="text" name="no_component_access_url" class="long_text_field" value="<?php echo $no_component_access_url; ?>" />
						
				</td>				
			</tr>
			<tr>
				<td colspan="3">&nbsp;
																								
				</td>
			</tr>			
			</table>
			</div>	
			<div id="menu_access">	
			<?php $this->controller->not_in_free_version(); ?>		
			<table class="adminlist">						
			<tr>
				<th colspan="3" align="left">					
					<?php echo JText::_('MENU_ACCESS'); ?>
				</th>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('USE_MENU_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" name="use_menuaccess" value="true" <?php if($this->controller->fua_config['use_menuaccess']){echo 'checked="checked"';} ?> />
				</td>
				<td>
				<?php 
					echo JText::_('MENU_INFO');
					echo '<br /><br />'; 
					echo '<a href="http://www.pages-and-items.com/hide-menu-items-in-other-menu-modules-then-the-fua/" target="_blank">'.JText::_('MAKE_YOUR_MENU_WORK_WITH_FUA').'</a>';
					$config =& JFactory::getConfig();
					if(!$config->getValue('sef')){
						echo ' <p><span class="warning">'.JText::_('SEF_NOT_ENABLED').'</span>.';
						echo ' '.JText::_('CACHE_INFO2');
						echo ' <a href="index.php?option=com_config">';
						echo JText::_('GLOBAL_CONFIG');
						echo '</a> ';
						echo JText::_('ON_TAB_SITE').'.';						
						echo '</p>';
					}				
				?>
				</td>
			</tr>			
			<tr>		
				<td>
					<?php echo JText::_('REVERSE_ACCESS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="menu_reverse_access" value="true" <?php if($this->controller->fua_config['menu_reverse_access']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('REVERSE_ACCESS_INFO'); ?>.					
				</td>
			</tr>
			<tr>		
				<td width="300">
					<?php echo JText::_('MENUACCESS_MESSAGE_TYPE'); 
					
					//set default when updating
					if(!$this->controller->fua_config['menuaccess_message_type']){
						$this->controller->fua_config['menuaccess_message_type'] = 'text';
					}
					
					?>
				</td>
				<td colspan="2">	
					<?php echo JText::_('NO_ACCESS_MESSAGE'); ?>:
					<input type="text" name="message_no_menu_access" class="long_text_field" value="<?php if($this->controller->fua_config['message_no_menu_access']){echo $this->controller->fua_config['message_no_menu_access'];}else{echo JText::_('NO_ACCESS_PAGE');} ?>" /><br />				
					<label><input type="radio" name="menuaccess_message_type" value="alert" class="radio" <?php if($this->controller->fua_config['menuaccess_message_type']=='alert'){echo 'checked="checked"';} ?> /><?php echo JText::_('COMPONENTS_MESSAGE_TYPE_ALERT'); ?></label><br />
					
					<label><input type="radio" name="menuaccess_message_type" value="inline_text" class="radio" <?php if($this->controller->fua_config['menuaccess_message_type']=='inline_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_INLINE_TEXT'); ?></label><br />
					
					<label><input type="radio" name="menuaccess_message_type" value="only_text" class="radio" <?php if($this->controller->fua_config['menuaccess_message_type']=='only_text'){echo 'checked="checked"';} ?> /><?php echo JText::_('MESSAGE_TYPE_ONLY_TEXT'); ?>.</label><br />
					<label><input type="radio" name="menuaccess_message_type" value="redirect" class="radio" <?php if($this->controller->fua_config['menuaccess_message_type']=='redirect'){echo 'checked="checked"';} ?> /><?php echo JText::_('REDIRECT_TO_URL'); ?></label>:
					<?php
					$no_menu_access_url = '';
					if($this->controller->fua_config['no_menu_access_url']){
						$no_menu_access_url = $this->controller->fua_config['no_menu_access_url'];
					}
					?>
					<input type="text" name="no_menu_access_url" class="long_text_field" value="<?php echo $no_menu_access_url; ?>" />
										
				</td>				
			</tr>
			<tr>		
				<td>
					<?php echo JText::_('DISPLAY_JOOMLA_ACCESS_LEVELS'); ?>
				</td>
				<td>
					<input type="checkbox" class="checkbox" name="display_joomla_access_levels" value="true" <?php if($this->controller->fua_config['display_joomla_access_levels']){echo 'checked="checked"';} ?> />
				</td>
				<td>
					<?php echo JText::_('DISPLAY_JOOMLA_ACCESS_LEVELS_INFO').' '.JText::_('JOOMLA_ACCESS_LEVELS_INFO'); ?>.					
				</td>
			</tr>			
			<tr>
				<td colspan="3">&nbsp;
																								
				</td>
			</tr>	
			</table>
			</div>
			<div id="paid_content">				
			<table class="adminlist">						
			<tr>
				<th colspan="3" align="left">					
					<?php echo JText::_('PAID_CONTENT'); ?>
				</th>
			</tr>
			<tr>							
				<td width="500">				
					<?php echo JText::_('PAID_CONTENT_INFO'); ?> <a href="http://extensions.joomla.org/extensions/e-commerce/subscriptions/10723" target="_blank"><?php echo JText::_('COMP_AEC'); ?></a>. <?php echo JText::_('PAID_CONTENT_INFO2'); ?>.<br /><br />				
				</td>
				<td>&nbsp;
				</td>		
				<td>&nbsp;
				</td>			
			</tr>
			<tr>
				<td colspan="3">&nbsp;																								
				</td>
			</tr>					
			</table>
			</div>					
		</div>
</form>
<?php
$this->controller->display_footer();
?>